<?php

class Admin_Model_Faq {

    private $_dbtable;

    public function __construct() {
        $this->_dbtable = new Admin_Model_DbTable_Faq();
    }

    /**
     * 
     * @param type $data
     * @return type
     */
    public function createFAQ($data) {
        return $this->_dbtable->insert($data);
    }

    /**
     * 
     * @param type $data
     * @param type $id
     * @return type
     */
    public function updateFAQ($data, $id) {
        return $this->_dbtable->update($data, "id = $id");
    }

    /**
     * 
     * @return type
     */
    public function fetchAll($enabled = false) {
        $select = $this->_dbtable->select();
        if ($enabled) {
            $select->where("enabled = true");
        }
        return $this->_dbtable->fetchAll($select);
    }

    /**
     * 
     * @param type $id
     * @return type
     */
    public function getById($id) {
        $select = $this->_dbtable->select();
        $select->where("id = $id");
        return $this->_dbtable->fetchAll($select);
    }

}

